package com.zyj.myapplication;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;

public class MainActivity extends AppCompatActivity {

    MyDialogFragment dialogFragment;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_main);

        //bottomSheet
        findViewById(R.id.btn1).setOnClickListener(v -> {
            startActivity(new Intent(this, BottomSheetActivity.class));
        });

        //bottomSheet
        findViewById(R.id.btn2).setOnClickListener(v -> {
            MyBottomSheetDialog bottomSheetDialog = new MyBottomSheetDialog(this);
            bottomSheetDialog.setContentView(R.layout.bottom_dialog_layout);
            bottomSheetDialog.show();
        });

        //bottomSheetFragmentDialog
        findViewById(R.id.btn3).setOnClickListener(v -> {
            if (dialogFragment == null) {
                dialogFragment = new MyDialogFragment();
                Bundle bundle = new Bundle();
                dialogFragment.setArguments(bundle);
            }
            dialogFragment.show(getSupportFragmentManager(), "dialog_fragment");
        });
    }
}